#pragma once
#include "xKernel/IxDraw.h"
#include "xKernel/IxTexture.h"

[
    default(IxTexture),
    threading(free),
    uuid("3EE1FB15-8ACA-4d02-82E3-2DCB9980DD94"),
    coclass
]
class ATL_NO_VTABLE CxTexture
    : public IxTexture
    , public IxDraw
{
public:
    CxTexture();
    virtual ~CxTexture();

public:
    // interface of IxTexture
    HRESULT GetFile(LPBSTR pbsFile);
    HRESULT SetFile(BSTR bsFile);
    HRESULT GetDrawMode(LPINT pnMode);
    HRESULT SetDrawMode(INT nMode);
    HRESULT GetStretchArea(LPRECT lprcStretch);
    HRESULT SetStretchArea(RECT rcStretch);
    HRESULT GetAlignment(LPINT pnAlignment);
    HRESULT SetAlignment(INT nAlignment);

    // interface of IxDraw
    HRESULT Draw(IxCanvas* pCanvas, RECT rcDest);

protected:
    void    _load();

protected:
    CString             m_strFile;
    INT                 m_nDrawMode;
    INT                 m_nAlignment;
    CRect               m_rcStretch;

    // to do ...
    Gdiplus::Bitmap*    m_pBitmap;
};